package code.google.jcontainer.support.inject;

import code.google.jcontainer.annotation.Resolve;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * &#64;Inject can annotate on Filed or Setter Method, indicate that need to inject another component or a constant<br>
 * &#64;@Inject will be parsed AFTER_CONSTRUCT
 *
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 */
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Resolve(resolverClass = InjectAnnotationResolver.class, when={Resolve.WHEN.AFTER_CONSTRUCT})
public @interface Inject {

    /**
     * the component name want to inject
     * if not specified, will inject the first one by Field/SetterMethod Class
     */
    String name() default "";

    /**
     * the associated key for constant value want to inject, these constants key/value are defined in inject.properties
     */
    String constantKey() default "";
}
